package coml.jiyun.hp.wanandroid.ui.fragment;


import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import butterknife.BindView;
import coml.jiyun.hp.wanandroid.R;
import coml.jiyun.hp.wanandroid.base.BaseLazyFragment;
import coml.jiyun.hp.wanandroid.bean.AnswerBean;
import coml.jiyun.hp.wanandroid.presenter.AnswerPresenter;
import coml.jiyun.hp.wanandroid.ui.adapter.RlvAnswerAdapter;
import coml.jiyun.hp.wanandroid.view.AnswerView;

/**
 * A simple {@link Fragment} subclass.
 */
public class AnswerFragment extends BaseLazyFragment<AnswerPresenter>implements AnswerView {

    @BindView(R.id.answer_rlv)
    RecyclerView mRlv;
    private RlvAnswerAdapter rlvAnswerAdapter;

    public AnswerFragment() {
        // Required empty public constructor
    }

    @Override
    protected void initListener() {

    }

    @Override
    protected void initData() {
        mPresenter.getAnswer();
    }

    @Override
    protected AnswerPresenter initPresenter() {
        return new AnswerPresenter();
    }

    @Override
    protected void initView(View view) {
        mRlv.setLayoutManager(new LinearLayoutManager(getActivity()));
        rlvAnswerAdapter = new RlvAnswerAdapter(getActivity());
        mRlv.setAdapter(rlvAnswerAdapter);
    }

    @Override
    protected int getLayout() {
        return R.layout.fragment_answer;
    }

    @Override
    public void getAnswer(AnswerBean answerBean) {
        rlvAnswerAdapter.setDatasBeans(answerBean.getData().getDatas());

    }

    @Override
    public void showLoading() {

    }

    @Override
    public void hideLoading() {

    }
}
